package com.bgs.engineering.api.syslog.service;


import com.baomidou.mybatisplus.extension.service.IService;
import com.bgs.engineering.util.pageUtil.PageRequest;
import com.bgs.engineering.util.pageUtil.PageResult;
import com.bgs.engineering.api.syslog.entity.SysLog;
import com.bgs.engineering.api.syslog.model.SysLogModel;
import com.bgs.engineering.common.errorCode.CommonException;
import com.bgs.engineering.common.response.CommonResult;

import java.util.List;
import java.util.Map;

/**
 * @auther zcy
 * @data 2023/3/22 13:35
 */
public interface SysLogService extends IService<SysLog> {

  /**
   * 分页查询日志
   *
   * @return
   */
  PageResult selectSysLogByPage(PageRequest pageRequest, SysLogModel sysLogModel);

  /**
   * 删除日志
   *
   * @param id
   * @return
   */
  CommonResult deleteSysLogById(Integer id) throws CommonException;

  /**
   * 根据id查询日志详情
   *
   * @param id
   * @return
   */
  SysLog selectSysLogById(Integer id) throws CommonException;

  /**
   * 获取操作日志和异常日志比率
   *
   * @param startTime
   * @param endTime
   * @return
   */
  Integer selectSysLogByTime(String startTime, String endTime);

  /**
   * 获取时间内所有用户操作的次数
   *
   * @param startTime
   * @param endTime
   * @return
   */
  List<Map<String, Object>> getLogAnalysis(String startTime, String endTime);

  /**
   * 获取时间内所有用户操作的次数
   *
   * @param startTime
   * @param endTime
   * @return
   */
  List<Map<String, Object>> getLoginIpCount(String startTime, String endTime);


  /**
   * 保存操作日志
   *
   * @param sysLogModel
   * @return
   * @throws CommonException
   */
  CommonResult saveSyslog(SysLogModel sysLogModel) throws CommonException;
}
